Skip to content

Rust: add invoke-agent example in bedrock-agent-runtime #7479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mattiapitossi
Copy link

@mattiapitossi mattiapitossi commented Jun 11, 2025

Hi there,

This pull request adds an example to use the invoke agent command in Rust:

  • Add bedrock-agent-runtime invoke-agent example
  • Example is based on the jsv3

Let me know if it makes sense for you.

Thanks!

command:

cargo run --bin invoke-agent

closes #7480


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the Rust This issue relates to the AWS SDK for Rust (Preview) label Jun 11, 2025
@tejasgn1 tejasgn1 self-requested a review June 17, 2025 18:59
@tejasgn1
Copy link

Hi @mattiapitossi , thanks for contributing. The code looks good, but the test cases are missing for this code piece. You can refer this jsv3 PR of invoke-agent which has tests. PR Link: #6129

@mattiapitossi
Copy link
Author

mattiapitossi commented Jun 20, 2025

Hi @tejasgn1, thanks for the feedback. I had to refactor a bit the code to make it unit-testable as it's a bit a difficult to mock directly the completion field of the EventReceiver result, so I directly mock the recv to make the test as close as possible to the one written in JS.

Let me know what do you think, thanks!

Test demo:

cargo test

image

@mattiapitossi
Copy link
Author

Added test case also for unhandled stream response type:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust This issue relates to the AWS SDK for Rust (Preview)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add bedrock-runtime-agent examples for Rust
2 participants